// token key
export const ACCESS_TOKEN_KEY = "ACCESS_TOKEN__";
export const REFRESH_TOKEN_KEY = "REFRESH_TOKEN__";
export const TENANT_ID_KEY = "TENANT_ID__";

export function getAuthCache(key) {
	return uni.getStorageSync(key);
}

export function setAuthCache(key, value) {
	return uni.setStorageSync(key, value);
}

export function clearAuthCache() {
	return uni.clearStorageSync();
}

export function removeAuthCache(key) {
	return uni.removeStorageSync(key);
}

export function getAccessToken(): string {
	return getAuthCache(ACCESS_TOKEN_KEY);
}

export function setAccessToken(value: string) {
	return setAuthCache(ACCESS_TOKEN_KEY, value);
}

export function removeAccessToken() {
	return removeAuthCache(ACCESS_TOKEN_KEY);
}

export function getTenantId() {
	return getAuthCache(TENANT_ID_KEY);
}

export function setTenantId(value) {
	return setAuthCache(TENANT_ID_KEY, value);
}
